EnemyFactory = {};
local this = EnemyFactory;

function EnemyFactory.New()
    coroutine.start(this.CreateEnemy, 10,3, 4, "Enemy", ThunderManager.prefabs[3], 5);
    coroutine.start(this.CreateBoss, 20,3, 10, "Enemy", ThunderManager.prefabs[6], 30);
   
end

function EnemyFactory.CreateEnemy(hp, speed, fireRate, tag, prefab, createTime)
   while true do
    local enemy = Enemy.new(hp,speed,fireRate, tag, prefab).gameObject;
    enemy.transform.position = Vector3(math.random( -2.5, 2.5), 6, 0);
    coroutine.wait(createTime)
   end
end

function EnemyFactory.CreateBoss(hp, speed, fireRate, tag, prefab, createTime)
    while true do
     local boss = Boss.new(hp,speed,fireRate, tag, prefab).gameObject;
     boss.transform.position = Vector3(math.random( -2.5, 2.5), 6, 0);
     coroutine.wait(createTime)
    end
 end